<?php

class Core_Backend_Component_Subject_View_Concessions_Index extends Core_Backend_Component_Promotion_View_Concessions_Index {

    protected function buildToolbar($toolbar) {
        $group = $toolbar->createGroup('selector');
        $group->addButton($this->__('share.button.selectAll'))
                ->bindEvent('click', "Kdf.Ui.getGrid('" . $this->getGrid()->getId() . "').selectAll()");
        $group->addButton($this->__('share.button.cancelSelected'))
                ->bindEvent('click', "Kdf.Ui.getGrid('" . $this->getGrid()->getId() . "').cancelSelected()");
        $group->addButton($this->__('share.button.selectInverse'))
                ->bindEvent('click', "Kdf.Ui.getGrid('" . $this->getGrid()->getId() . "').selectInverse()");
        $group = $toolbar->createGroup('status');
        $group->addButton($this->__('share.button.publish'))
                ->bindEvent('click', "submitGridChecked('" . $this->getGrid()->getId() . "', '" . $this->getUrl(array('status'=>'published'), 'review') . "')");
        $group->addButton($this->__('share.button.forbid'))
                ->bindEvent('click', "forbidGridChecked('" . $this->getGrid()->getId() . "', '" . $this->getUrl(array('status'=>'forbidden'), 'review') . "')");
        $group = $toolbar->createGroup('delete');
        $group->addButton($this->__('share.button.delete'))
                ->bindEvent('click', "submitGridChecked('" . $this->getGrid()->getId() . "', '" . $this->getUrl(NULL, 'deleteConcessions') . "')");
    }

    protected function buildGrid($grid) {
        parent::buildGrid($grid);
        $grid->removeColumn('edit');
        $grid->removeColumn('status');
        $grid->addLabelColumn($this->__('share.label.status'), 'subject_status', '{subject_status}')
                ->setSortField('subject_status')
                ->setWidth(80);
        $grid->addLinkColumn('#', 'preview', $this->getUrl(array('id' => '{id}'), 'preview'), $this->__('subject.label.pendding'))
                ->setWidth(40)
                ->setAlign('center');
    }

    protected function buildPagination($pagination) {
        $pagination->setUrlFormat($this->getPaginationUrl())->setRecordCount($this->getRecords());
        parent::buildPagination($pagination);
    }

}